/*    */ package com.zimbra.cs.memcached;
/*    */ 
/*    */ import com.zimbra.common.service.ServiceException;
/*    */ import com.zimbra.common.util.memcached.ZimbraMemcachedClient;
/*    */ import com.zimbra.cs.account.Provisioning;
/*    */ import com.zimbra.cs.account.Server;
/*    */ import net.spy.memcached.HashAlgorithm;
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ public class MemcachedConnector
/*    */ {
/* 29 */   private static ZimbraMemcachedClient sTheClient = new ZimbraMemcachedClient();
/*    */   
/*    */ 
/*    */ 
/*    */ 
/*    */   public static ZimbraMemcachedClient getClient()
/*    */   {
/* 36 */     return sTheClient;
/*    */   }
/*    */   
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */   public static void startup()
/*    */     throws ServiceException
/*    */   {}
/*    */   
/*    */ 
/*    */ 
/*    */ 
/*    */   public static boolean isConnected()
/*    */   {
/* 52 */     return sTheClient.isConnected();
/*    */   }
/*    */   
/*    */ 
/*    */ 
/*    */ 
/*    */   public static void reloadConfig()
/*    */     throws ServiceException
/*    */   {
/* 61 */     Server server = Provisioning.getInstance().getLocalServer();
/* 62 */     String[] serverList = server.getMultiAttr("zimbraMemcachedClientServerList");
/* 63 */     boolean useBinaryProtocol = server.getBooleanAttr("zimbraMemcachedClientBinaryProtocolEnabled", false);
/* 64 */     String hashAlgorithm = server.getAttr("zimbraMemcachedClientHashAlgorithm", HashAlgorithm.KETAMA_HASH.toString());
/* 65 */     int expirySeconds = (int)server.getLongAttr("zimbraMemcachedClientExpirySeconds", 86400L);
/* 66 */     long timeoutMillis = server.getLongAttr("zimbraMemcachedClientTimeoutMillis", 10000L);
/* 67 */     sTheClient.connect(serverList, useBinaryProtocol, hashAlgorithm, expirySeconds, timeoutMillis);
/*    */   }
/*    */   
/*    */ 
/*    */ 
/*    */   public static void shutdown()
/*    */     throws ServiceException
/*    */   {
/* 75 */     sTheClient.disconnect(30000L);
/*    */   }
/*    */ }


/* Location:              /home/mint/zimbrastore.jar!/com/zimbra/cs/memcached/MemcachedConnector.class
 * Java compiler version: 7 (51.0)
 * JD-Core Version:       0.7.1
 */